package com.ssy.lingxi.transaction.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 商品询价-询价单内部状态枚举类
 *
 * @author wrc
 * @date 2020/11/18
 */
public enum InquiryInteriorStatusEnum {

    TO_BE_SUBMITTED_FOR_REVIEW(1, "待提交审核"),
    TO_BE_REVIEWED(2, "待审核(一级)"),
    TO_BE_REVIEWED_two(3, "待审核(二级)"),
    APPROVED(4, "待提交询价单"),
    APPROVED_TWO(5, "审核通过"),
    FAILED_TO_PASS_THE_AUDIT(6, "审核不通过(一级)"),
    FAILED_TO_PASS_THE_AUDIT2(7, "审核不通过(二级)"),
    ;
    /**
     * 状态
     */
    private Integer state;


    /**
     * 描述
     */
    private String name;

    public static String getName(Integer state){
        InquiryInteriorStatusEnum workEnum = Arrays.stream(InquiryInteriorStatusEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(InquiryInteriorStatusEnum.class, workEnum.getState());
    }

    InquiryInteriorStatusEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }

}
